<!DOCTYPE HTML>
<html>

<head>
    <title>宏玄餐饮B2C店</title>
    <link href="__PUBLIC__/css/bootstrap.css" rel="stylesheet" type="text/css" media="all">
    <link href="__PUBLIC__/css/style.css" rel="stylesheet" type="text/css" media="all" />
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="keywords" content="Spicemystery Responsive web template, Bootstrap Web Templates, Flat Web Templates, Andriod Compatible web template,
Smartphone Compatible web template, free webdesigns for Nokia, Samsung, LG, SonyErricsson, Motorola web design" />
    <script type="application/x-javascript">
    addEventListener("load", function() {
        setTimeout(hideURLbar, 0);
    }, false);

    function hideURLbar() {
        window.scrollTo(0, 1);
    }
    </script>
    <script src="__PUBLIC__/js/jquery.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/css/flexslider.css" type="text/css" media="screen" />
    <script src="__PUBLIC__/js/simpleCart.min.js">
    </script>
</head>

<body>
    <!-- header -->
    <div class="head-top">
    </div>
    <div class="header">
        <div class="container">
            <div class="logo">
                <a href="index.html"><img src="__PUBLIC__/images/logo.png" class="img-responsive" alt="" width="236px;" /></a>
            </div>
            <div class="header-left">
                <div class="head-nav">
                    <span class="menu"> </span>
                    <ul>
                        <li><a href="{:U('Index/Index/index')}">主页</a></li>
                        <li><a href="{:U('Index/Menu/index')}">所有菜品</a></li>
                        <li><a href="{:U('Index/Menu/category')}">分类菜品</a></li>
                        <li><a href="{:U('Index/Index/aboutus')}">关于我们</a></li>
                        <if condition="isset($_SESSION['user_id'])">
                            <li><a href="{:U('Index/User/index')}">欢迎 {$_SESSION['user_name']}</a></li>
                            <li><a href="{:U('Index/Index/logout')}">退出</a></li>
                            <else />
                            <li><a href="{:U('Index/Login/index')}">登录/注册</a></li>
                        </if>
                        <div class="clearfix"> </div>
                    </ul>
                    <!-- script-for-nav -->
                    <script>
                    $("span.menu").click(function() {
                        $(".head-nav ul").slideToggle(300, function() {
                            // Animation complete.
                        });
                    });
                    </script>
                    <!-- script-for-nav -->
                </div>
                <div class="header-right1">
                    <div class="cart box_1">
                        <a href="{:U('Index/User/myshoppingcar')}">
                            <h3> <span class="simpleCart_total"> &yen;0.00 </span> (<span id="simpleCart_quantity" class="simpleCart_quantity"> 0 </span> 项)<img src="__PUBLIC__/images/bag.png" alt=""></h3>
                        </a>
                        <p><a href="javascript:;" class="simpleCart_empty">清空购物车</a></p>
                        <div class="clearfix"> </div>
                    </div>
                </div>
                <div class="clearfix"> </div>
            </div>
            <div class="clearfix"> </div>
        </div>
    </div>
    <!-- header -->
    <!-- checkout -->
    <div class="cart-items">
        <div class="container">
            <h1>我的购物车 ( <span id="simpleCart_quantity" class="simpleCart_quantity">0</span> 项 )</h1>
            <form action="{:U('Index/User/addOrder')}" method="post">
                <div class="table-responsive m-t">
                    <table class="simpleCart_items table invoice-table">
                    </table>
                </div>
                <table class="table invoice-total">
                    <tbody>
                        <tr>
                            <td><strong>总计（打折后）：</strong>
                            </td>
                            <td><b class="simpleCart_total" style="color:red;"></b></td>
                        </tr>
                    </tbody>
                </table>
                <center>
	                <if condition="isset($_SESSION['user_id'])">
	                	<input type="text" style="display: none;" name="user_id" value="{$_SESSION['user_id']}" />
	                	<input type="text" style="display: none;" name="foods" value="" />
	                	<input type="text" style="display: none;" name="quantity" value="" />
                        <button type="submit" class="simpleCart_empty morebtn addtocard btn btn-success">生成订单</button>
                        <!-- <input type="submit" style="width:9%;" class="simpleCart_empty morebtn hvr-rectangle-in addtocard" value="生成订单" /> -->
                    <else />
                        <button onclick="alert('请先登录！');" type="button" class="morebtn addtocard btn btn-success">生成订单</button>
                    	<!-- <a onclick="alert('请先登录！');" style="width:9%;" class="morebtn hvr-rectangle-in addtocard" >生成订单</a> -->
                    </if>
                </center>
            </form>
        </div>
    </div>
	<if condition="isset($_SESSION['user_id'])">
	<!-- 获取菜品ID及其相应份数，分别拼接成字符串 -->
		<script type="text/javascript">
		var ids      = document.getElementsByName('ids[]');
		var quantity = document.getElementsByName('quantitys[]');
		$('.addtocard').click(function(){
			var food_ids = '';
			var counts   = '';
			for(var i=0; i<ids.length-1; i++){
				food_ids += ids[i].value + ','
				counts += quantity[i].value + ','
			}
			food_ids += ids[ids.length-1].value;
			counts   += quantity[ids.length-1].value;
			document.getElementsByName('foods')[0].value = food_ids;
			document.getElementsByName('quantity')[0].value = counts;
		});
		</script>
	</if>
    <!-- checkout -->
    <!-- header begin -->
    <include file="Common/footer" />
    <!-- header end -->
